<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>数字八字排盘</title>
    <link rel="stylesheet" href="style.css">
</head>
<style>
    * {
        margin: 0;
        padding: 0;
        text-align: center;
    }
    
    li {
        list-style: none;
    }
    
    body {
        margin-left: 10px;
    }
    
    .rq li {
        text-align: left;
        height: 35px;
        font-weight: 700;
    }
    
    .rq li input {
        border-radius: 12px;
    }
    
    .button {
        width: 60px;
        margin-top: 8px;
        text-align: left;
        margin-left: 80.5px;
    }
    
    #btn {
        width: 60px;
        border-radius: 10px;
        color: cornflowerblue;
        font-weight: 700;
        cursor: pointer;
    }
    
    .a {
        height: 25px;
        margin-top: 15px;
        margin-left: 50px;
    }
    
    .a li {
        width: 25px;
        height: 25px;
        float: left;
    }
    
    .b {
        height: 25px;
    }
    
    .b li {
        width: 25px;
        height: 25px;
        float: left;
    }
    
    .b li:first-child {
        width: 50px;
    }
    
    .c {
        height: 25px;
    }
    
    .c li {
        width: 25px;
        height: 25px;
        float: left;
    }
    
    .c li:first-child {
        width: 50px;
    }
    
    .d {
        height: 25px;
        margin-left: 50px;
    }
    
    .d li {
        width: 25px;
        height: 25px;
        float: left;
    }
    
    body .jh {
        width: 10px;
    }
    
    .bazi {
        float: left;
        width: 350px;
        height: 345px;
        border-bottom-right-radius: 60px;
        font-weight: 700;
        background-color: rgba(255, 255, 255, 0.534);
    }
    
    .scbg {
        position: absolute;
        margin-top: 375px;
        width: 642px;
        height: 272px;
    }
    
    .scbg table {
        width: 642px;
    }
    
    .cssc {
        margin-top: 20px;
    }
    
    .cssc li {
        text-align: left;
    }
    
    .bjlc {
        position: absolute;
        margin-top: 469px;
        width: 642px;
        height: 272px;
    }
</style>


<body>
    <div class="bazi">
        <ul class="rq">
            <form action="" id="myform1">
                <li>年: &nbsp;<input value="" type="number" placeholder="请输入年" id="year"></li>
                <li>月: &nbsp;<input value="" type="number" placeholder="请输入月" id="month"></li>
                <li>日: &nbsp;<input value="" type="number" placeholder="请输入日" id="date"></li>
                <li class="shic">时: &nbsp;<input value="" type="number" placeholder="请输入时辰对应的数字" id="time">（时辰未知可不填）</li>
            </form>
        </ul>
        <ul class="button"> <button id="btn">排盘</button></ul>
        <ul class="cssc">
            <form action="" id="myform2">
                <li id="csscli" style="visibility: hidden;"></li>
            </form>
        </ul>
        <div id="pp" style="visibility: hidden;">
            <form action="" id="myform3">
                <div class="a">
                    <ul>
                        <li id="a1"></li>
                        <li class="jh"></li>
                        <li id="a2"></li>
                        <li class="jh"></li>
                        <li id="a3"></li>
                        <li class="jh"></li>
                        <li id="a4"></li>
                        <li class="jh"></li>
                        <li id="a5"></li>
                        <li class="jh"></li>
                        <li id="a6"></li>
                    </ul>
                </div>
                <div class="b">
                    <ul>
                        <li class="s">上卦：</li>
                        <li id="s1"></li>
                        <li class="jh">-</li>
                        <li id="s2"></li>
                        <li class="jh">-</li>
                        <li id="s3"></li>
                        <li class="jh">-</li>
                        <li id="s4"></li>
                        <li class="jh" id="yc121">-</li>
                        <li id="s5"></li>
                        <li class="jh" id="yc122">-</li>
                        <li id="s6"></li>
                    </ul>
                </div>
                <div class="c">
                    <ul>
                        <li class="x">下卦：</li>
                        <li id="x1"></li>
                        <li class="jh" id="test">-</li>
                        <li id="x2"></li>
                        <li class="jh">-</li>
                        <li id="x3"></li>
                        <li class="jh">-</li>
                        <li id="x4"></li>
                        <li class="jh" id="yc123">-</li>
                        <li id="x5"></li>
                        <li class="jh" id="yc124">-</li>
                        <li id="x6"></li>
                    </ul>
                </div>
                <div class="d">
                    <ul>
                        <li id="d1"></li>
                        <li class="jh"></li>
                        <li id="d2"></li>
                        <li class="jh"></li>
                        <li id="d3"></li>
                        <li class="jh"></li>
                        <li id="d4"></li>
                        <li class="jh"></li>
                        <li id="d5"></li>
                        <li class="jh"></li>
                        <li id="d6"></li>
                    </ul>
                </div>
            </form>
        </div>
    </div>
    <div class="scbg">
        <table border="1" cellspacing="0" style="background-color: rgba(255, 255, 255, 0.301);">
            <tr>
                <th>子时-1-鼠</th>
                <th>丑时-2-牛</th>
                <th>寅时-3-虎</th>
                <th>卯时-4-兔</th>
                <th>辰时-5-龙</th>
                <th>巳时-6-蛇</th>
            </tr>
            <tr>
                <td>23:00-1:00</td>
                <td>1:00-3:00</td>
                <td>3:00-5:00</td>
                <td>5:00-7:00</td>
                <td>7:00-9:00</td>
                <td>9:00-11:00</td>
            </tr>
            <tr>
                <th>午时-7-马</th>
                <th>未时-8-羊</th>
                <th>申时-9-猴</th>
                <th>酉时-10-鸡</th>
                <th>戌时-11-狗</th>
                <th>亥时-12-猪</th>
            </tr>
            <tr>
                <td>11:00-13:00</td>
                <td>13:00-15:00</td>
                <td>15:00-17:00</td>
                <td>17:00-19:00</td>
                <td>19:00-21:00</td>
                <td>21:00-23:00</td>
            </tr>
        </table>
    </div>
    <div class="jiegua">
    <table border="1" cellspacing="0" style="background-color: rgba(255, 255, 255, 0.301);">
		<tr>
			<th>五行相克</th>
			<th>数字对应五行</th>
		</tr>
		<tr>
			<th>金克木(影响肝胆健康)</th>
			<th>金:10、11;(财富:10 正财、11偏财，代表口肺呼吸系统)</th>
		</tr>
		<tr>
			<th>木克土(财库破洞，脾胃不和)</th>
			<th>水:1、2、12;(智慧星，代表腰肾)</th>
		</tr>
		<tr>
			<th>土克水(影响学业、腰肾健康)</th>
			<th>木:4、5;(代表肝胆)</th>
		</tr>
		<tr>
			<th>水克火(影响眼睛心脏健康)</th>
			<th>火:6、7;(代表眼睛心脏)</th>
		</tr>
		<tr>
			<th>火克金(破财、影响呼吸系统健康)</th>
			<th>士:3、8、9(3遇 8/9 变木)(财库，代表脾胃)</th>
		</tr>
	
    </div>
    <div class="bjlc">
        <img src="images/八绝六冲.png" alt="">
        <img src="images/五行.png" alt="" width="640" height="85">
    </div>
    <video src="images/bgrd-video.mp4" loop="loop" autoplay="autoplay"></video>
</body>
<script>
    var btn = document.querySelector('#btn');
    var pp = document.querySelector('#pp');
    var flag = 0;

    btn.onclick = function() {
        var year = Number(document.getElementById("year").value);
        var month = Number(document.getElementById("month").value);
        var date = Number(document.getElementById("date").value);
        var time = Number(document.getElementById("time").value);
        var csscli = document.getElementById("csscli");
        //当输入年月日时候获取数据

        if (year > 1900 && month >= 1 && month <= 12 && date >= 1 && date <= 30 && time >= 0 && time <= 12) {
            if (flag == 0) {
                pp.style.visibility = "visible";
                csscli.style.visibility = "visible";
                btn.innerHTML = "重置";
                flag = 1;
                //卦主出生日期
                var shichen = ['（时辰未知，用问号代替）', '子时', '丑时', '寅时', '卯时', '辰时', '巳时', '午时', '未时', '申时', '酉时', '戌时', '亥时']
                var nyrs = '农历' + year + '年' + month + '月' + date + '日' + '&nbsp;' + shichen[time];
                csscli.innerHTML = nyrs;
                var yc121 = document.getElementById("yc121");
                var yc122 = document.getElementById("yc122");
                var yc123 = document.getElementById("yc123");
                var yc124 = document.getElementById("yc124");
                yc121.style.visibility = "visible";
                yc122.style.visibility = "visible";
                yc123.style.visibility = "visible";
                yc124.style.visibility = "visible";
                return getbzpp();
            } else if (flag == 1) {
                //location.reload();
                document.getElementById("myform1").reset();
                document.getElementById("myform2").reset();
                document.getElementById("myform3").reset();
                var yc121 = document.getElementById("yc121");
                var yc122 = document.getElementById("yc122");
                var yc123 = document.getElementById("yc123");
                var yc124 = document.getElementById("yc124");
                yc121.style.visibility = "hidden";
                yc122.style.visibility = "hidden";
                yc123.style.visibility = "hidden";
                yc124.style.visibility = "hidden";
                csscli.style.visibility = "hidden";

                var a5 = document.getElementById("a5");
                var d5 = document.getElementById("d5");
                var a6 = document.getElementById("a6");
                var d6 = document.getElementById("d6");
                var s5 = document.getElementById("s5");
                var x5 = document.getElementById("x5");
                var s6 = document.getElementById("s6");
                var x6 = document.getElementById("x6");
                a5.style.visibility = "hidden";
                d5.style.visibility = "hidden";
                a6.style.visibility = "hidden";
                d6.style.visibility = "hidden";
                s5.style.visibility = "hidden";
                x5.style.visibility = "hidden";
                s6.style.visibility = "hidden";
                x6.style.visibility = "hidden";

                pp.style.visibility = "hidden";
                btn.innerHTML = "排盘";
                flag = 0;

            }

        } else {
            alert('请输入正确的日期')
        }


        function getbzpp() {
            //年的上下卦+五行
            function y(year) {

                //年的上卦
                var arr = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'];
                var sx = arr[((year - 1900) % 12 + 12) % 12];
                var s1 = document.getElementById("s1");
                s1.innerHTML = sx;
                sx = Number(sx);
                //年的下卦
                var x1 = document.getElementById("x1");

                function getnxg(sx) {
                    if (sx <= 6) {
                        x1.innerHTML = sx + 6;
                        x1 = sx + 6;
                        return x1;
                    } else {
                        x1.innerHTML = sx - 6;
                        x1 = sx - 6;
                        return x1;
                    }

                }
                var nxg = getnxg(sx);
                console.log(nxg);



                //上卦+下卦年五行
                var a1 = document.getElementById("a1");
                var d1 = document.getElementById("d1");

                function sgnwx(sx) {

                    //上卦年五行

                    if (sx == 1 || sx == 2 || sx == 12) {
                        a1.innerHTML = "水";
                    } else if (sx == 3 || sx == 8 || sx == 9) {
                        a1.innerHTML = "土";
                    } else if (sx == 4 || sx == 5) {
                        a1.innerHTML = "木";
                    } else if (sx == 6 || sx == 7) {
                        a1.innerHTML = "火";
                    } else if (sx == 10 || sx == 11) {
                        a1.innerHTML = "金";
                    }
                }
                sgnwx(sx);


                //下卦年五行 
                function xgnwx(nxg) {
                    if (nxg == 1 || nxg == 2 || nxg == 12) {
                        d1.innerHTML = "水";
                    } else if (nxg == 3 || nxg == 8 || nxg == 9) {
                        d1.innerHTML = "土";
                    } else if (nxg == 4 || nxg == 5) {
                        d1.innerHTML = "木";
                    } else if (nxg == 6 || nxg == 7) {
                        d1.innerHTML = "火";
                    } else if (nxg == 10 || nxg == 11) {
                        d1.innerHTML = "金";
                    }
                }
                xgnwx(nxg);
            }
            y(year);

            //月的上下卦+五行
            function m(month) {

                //月的上卦
                var s2 = document.getElementById("s2");
                s2.innerHTML = month;
                s2 = month;
                //月的下卦
                var x2 = document.getElementById("x2");

                function getnxg(month) {
                    if (month <= 6) {
                        x2.innerHTML = month + 6;
                        x2 = month + 6;
                        return x2;
                    } else {
                        x2.innerHTML = month - 6;
                        x2 = month - 6;
                        return x2;
                    }

                }
                var yxg = getnxg(month);

                //上卦+下卦年五行
                var a2 = document.getElementById("a2");
                var d2 = document.getElementById("d2");

                function sgywx(month) {

                    //上卦月五行

                    if (month == 1 || month == 2 || month == 12) {
                        a2.innerHTML = "水";
                    } else if (month == 3 || month == 8 || month == 9) {
                        a2.innerHTML = "土";
                    } else if (month == 4 || month == 5) {
                        a2.innerHTML = "木";
                    } else if (month == 6 || month == 7) {
                        a2.innerHTML = "火";
                    } else if (month == 10 || month == 11) {
                        a2.innerHTML = "金";
                    }
                }
                sgywx(month);


                //下卦月五行 
                function xgywx(yxg) {
                    if (yxg == 1 || yxg == 2 || yxg == 12) {
                        d2.innerHTML = "水";
                    } else if (yxg == 3 || yxg == 8 || yxg == 9) {
                        d2.innerHTML = "土";
                    } else if (yxg == 4 || yxg == 5) {
                        d2.innerHTML = "木";
                    } else if (yxg == 6 || yxg == 7) {
                        d2.innerHTML = "火";
                    } else if (yxg == 10 || yxg == 11) {
                        d2.innerHTML = "金";
                    }
                }
                xgywx(yxg);
            }
            m(month);

            //日的上下卦+五行
            function r(date) {

                //1.当日小于等于12时

                if (date <= 12) {
                    var yc121 = document.getElementById("yc121");
                    var yc122 = document.getElementById("yc122");
                    var yc123 = document.getElementById("yc123");
                    var yc124 = document.getElementById("yc124");
                    yc121.style.visibility = "hidden";
                    yc122.style.visibility = "hidden";
                    yc123.style.visibility = "hidden";
                    yc124.style.visibility = "hidden";

                    var a5 = document.getElementById("a5");
                    var d5 = document.getElementById("d5");
                    var a6 = document.getElementById("a6");
                    var d6 = document.getElementById("d6");
                    var s5 = document.getElementById("s5");
                    var x5 = document.getElementById("x5");
                    var s6 = document.getElementById("s6");
                    var x6 = document.getElementById("x6");
                    a5.style.visibility = "hidden";
                    d5.style.visibility = "hidden";
                    a6.style.visibility = "hidden";
                    d6.style.visibility = "hidden";
                    s5.style.visibility = "hidden";
                    x5.style.visibility = "hidden";
                    s6.style.visibility = "hidden";
                    x6.style.visibility = "hidden";



                    //日的上卦
                    var s3 = document.getElementById("s3");
                    s3.innerHTML = date;
                    s3 = date;
                    //日的下卦
                    var x3 = document.getElementById("x3");

                    function getrxg(date) {
                        if (date <= 6) {
                            x3.innerHTML = date + 6;
                            x3 = date + 6;
                            return x3;
                        } else {
                            x3.innerHTML = date - 6;
                            x3 = date - 6;
                            return x3;
                        }

                    }
                    var rxg = getrxg(date);

                    //上卦+下卦日五行
                    var a3 = document.getElementById("a3");
                    var d3 = document.getElementById("d3");

                    function sgrwx(date) {

                        //上卦日五行

                        if (date == 1 || date == 2 || date == 12) {
                            a3.innerHTML = "水";
                        } else if (date == 3 || date == 8 || date == 9) {
                            a3.innerHTML = "土";
                        } else if (date == 4 || date == 5) {
                            a3.innerHTML = "木";
                        } else if (date == 6 || date == 7) {
                            a3.innerHTML = "火";
                        } else if (date == 10 || date == 11) {
                            a3.innerHTML = "金";
                        }
                    }
                    sgrwx(date);


                    //下卦日五行 
                    function xgrwx(rxg) {
                        if (rxg == 1 || rxg == 2 || rxg == 12) {
                            d3.innerHTML = "水";
                        } else if (rxg == 3 || rxg == 8 || rxg == 9) {
                            d3.innerHTML = "土";
                        } else if (rxg == 4 || rxg == 5) {
                            d3.innerHTML = "木";
                        } else if (rxg == 6 || rxg == 7) {
                            d3.innerHTML = "火";
                        } else if (rxg == 10 || rxg == 11) {
                            d3.innerHTML = "金";
                        }
                    }
                    xgrwx(rxg);



                    //时的上下卦+五行
                    if (time == 0) {
                        //时的上卦
                        var s4 = document.getElementById("s4");
                        s4.innerHTML = "?";
                        //时的下卦
                        var x4 = document.getElementById("x4");
                        x4.innerHTML = "?";

                        //上卦+下卦时五行
                        var a4 = document.getElementById("a4");
                        var d4 = document.getElementById("d4");
                        a4.innerHTML = "?";
                        d4.innerHTML = "?";
                    } else { //时的上卦

                        var s4 = document.getElementById("s4");
                        s4.innerHTML = time;
                        s4 = time;
                        //时的下卦
                        var x4 = document.getElementById("x4");

                        function getsxg(time) {
                            if (time <= 6 && time != 0) {
                                x4.innerHTML = time + 6;
                                x4 = time + 6;
                                return x4;
                            } else {
                                x4.innerHTML = time - 6;
                                x4 = time - 6;
                                return x4;
                            }

                        }
                        var sxg = getsxg(time);

                        //上卦+下卦时五行
                        var a4 = document.getElementById("a4");
                        var d4 = document.getElementById("d4");

                        function sgswx(time) {

                            //上卦时五行

                            if (time == 1 || time == 2 || time == 12) {
                                a4.innerHTML = "水";
                            } else if (time == 3 || time == 8 || time == 9) {
                                a4.innerHTML = "土";
                            } else if (time == 4 || time == 5) {
                                a4.innerHTML = "木";
                            } else if (time == 6 || time == 7) {
                                a4.innerHTML = "火";
                            } else if (time == 10 || time == 11) {
                                a4.innerHTML = "金";
                            }
                        }
                        sgswx(time);


                        //下卦时五行 
                        function xgswx(sxg) {
                            if (sxg == 1 || sxg == 2 || sxg == 12) {
                                d4.innerHTML = "水";
                            } else if (sxg == 3 || sxg == 8 || sxg == 9) {
                                d4.innerHTML = "土";
                            } else if (sxg == 4 || sxg == 5) {
                                d4.innerHTML = "木";
                            } else if (sxg == 6 || sxg == 7) {
                                d4.innerHTML = "火";
                            } else if (sxg == 10 || sxg == 11) {
                                d4.innerHTML = "金";
                            }
                        }
                        xgswx(sxg);


                    }

                } else if (date == 20 || date == 30) {
                    var yc124 = document.getElementById("yc124");
                    var yc122 = document.getElementById("yc122");
                    yc122.style.visibility = "hidden";
                    yc124.style.visibility = "hidden";
                    //日的上卦,下卦，五行
                    var s3 = document.getElementById("s3");
                    var s4 = document.getElementById("s4");
                    var x3 = document.getElementById("x3");
                    var x4 = document.getElementById("x4");
                    var a4 = document.getElementById("a4");
                    var a3 = document.getElementById("a3");
                    var d4 = document.getElementById("d4");
                    var d3 = document.getElementById("d3");


                    var a5 = document.getElementById("a5");
                    var d5 = document.getElementById("d5");
                    var a6 = document.getElementById("a6");
                    var d6 = document.getElementById("d6");
                    var s5 = document.getElementById("s5");
                    var x5 = document.getElementById("x5");
                    var s6 = document.getElementById("s6");
                    var x6 = document.getElementById("x6");
                    a5.style.visibility = "visible";
                    d5.style.visibility = "visible";
                    a6.style.visibility = "hidden";
                    d6.style.visibility = "hidden";
                    s5.style.visibility = "visible";
                    x5.style.visibility = "visible";
                    s6.style.visibility = "hidden";
                    x6.style.visibility = "hidden";
                    if (date == 20) {
                        s3.innerHTML = 2;
                        a3.innerHTML = "水";
                        x3.innerHTML = 8;
                        d3.innerHTML = "土";

                        s4.innerHTML = 10;
                        a4.innerHTML = "金";
                        x4.innerHTML = 4;
                        d4.innerHTML = "木";
                    } else if (date == 30) {
                        s3.innerHTML = 3;
                        a3.innerHTML = "土";
                        x3.innerHTML = 9;
                        d3.innerHTML = "土";

                        s4.innerHTML = 10;
                        a4.innerHTML = "金";
                        x4.innerHTML = 4;
                        d4.innerHTML = "木";
                    }


                    //时的上下卦+五行
                    if (time == 0) {
                        //时的上卦
                        var s5 = document.getElementById("s5");
                        s5.innerHTML = "?";
                        //时的下卦
                        var x5 = document.getElementById("x5");
                        x5.innerHTML = "?";
                        //上卦+下卦时五行
                        var a5 = document.getElementById("a5");
                        var d5 = document.getElementById("d5");
                        //上卦时五行
                        a5.innerHTML = "?";
                        d5.innerHTML = "?";
                    } else {
                        //时的上卦
                        var s5 = document.getElementById("s5");
                        s5.innerHTML = time;
                        s5 = time;
                        //时的下卦
                        var x5 = document.getElementById("x5");

                        function getsxg(time) {
                            if (time <= 6) {
                                x5.innerHTML = time + 6;
                                x5 = time + 6;
                                return x5;
                            } else {
                                x5.innerHTML = time - 6;
                                x5 = time - 6;
                                return x5;
                            }

                        }
                        var sxg = getsxg(time);

                        //上卦+下卦时五行
                        var a5 = document.getElementById("a5");
                        var d5 = document.getElementById("d5");

                        function sgswx(time) {

                            //上卦时五行

                            if (time == 1 || time == 2 || time == 12) {
                                a5.innerHTML = "水";
                            } else if (time == 3 || time == 8 || time == 9) {
                                a5.innerHTML = "土";
                            } else if (time == 4 || time == 5) {
                                a5.innerHTML = "木";
                            } else if (time == 6 || time == 7) {
                                a5.innerHTML = "火";
                            } else if (time == 10 || time == 11) {
                                a5.innerHTML = "金";
                            }
                        }
                        sgswx(time);

                        //下卦时五行 
                        function xgswx(sxg) {
                            if (sxg == 1 || sxg == 2 || sxg == 12) {
                                d5.innerHTML = "水";
                            } else if (sxg == 3 || sxg == 8 || sxg == 9) {
                                d5.innerHTML = "土";
                            } else if (sxg == 4 || sxg == 5) {
                                d5.innerHTML = "木";
                            } else if (sxg == 6 || sxg == 7) {
                                d5.innerHTML = "火";
                            } else if (sxg == 10 || sxg == 11) {
                                d5.innerHTML = "金";
                            }
                        }
                        xgswx(sxg);
                    }

                } else {
                    var s3 = document.getElementById("s3");
                    var s4 = document.getElementById("s4");
                    var x3 = document.getElementById("x3");
                    var x4 = document.getElementById("x4");
                    var a4 = document.getElementById("a4");
                    var a3 = document.getElementById("a3");
                    var d4 = document.getElementById("d4");
                    var d3 = document.getElementById("d3");
                    var d5 = document.getElementById("d5");
                    var a5 = document.getElementById("a5");
                    var s5 = document.getElementById("s5");
                    var x5 = document.getElementById("x5");

                    var a5 = document.getElementById("a5");
                    var d5 = document.getElementById("d5");
                    var a6 = document.getElementById("a6");
                    var d6 = document.getElementById("d6");
                    var s5 = document.getElementById("s5");
                    var x5 = document.getElementById("x5");
                    var s6 = document.getElementById("s6");
                    var x6 = document.getElementById("x6");
                    a5.style.visibility = "visible";
                    d5.style.visibility = "visible";
                    a6.style.visibility = "visible";
                    d6.style.visibility = "visible";
                    s5.style.visibility = "visible";
                    x5.style.visibility = "visible";
                    s6.style.visibility = "visible";
                    x6.style.visibility = "visible";
                    //日 拆分的 第一个上下卦

                    //日的上卦
                    s3.innerHTML = parseInt(date % 100 / 10);
                    s3 = parseInt(date % 100 / 10);
                    console.log(s3);
                    //日的下卦
                    function getrxg1(s3) {
                        if (s3 <= 6) {
                            x3.innerHTML = s3 + 6;
                            x3 = s3 + 6;
                            return x3;
                        } else {
                            x3.innerHTML = s3 - 6;
                            x3 = s3 - 6;
                            return x3;
                        }

                    }
                    var rxg1 = getrxg1(s3);

                    //上卦+下卦日五行
                    function sgrwx1(s3) {

                        //上卦日五行

                        if (s3 == 1 || s3 == 2 || s3 == 12) {
                            a3.innerHTML = "水";
                        } else if (s3 == 3 || s3 == 8 || s3 == 9) {
                            a3.innerHTML = "土";
                        } else if (s3 == 4 || s3 == 5) {
                            a3.innerHTML = "木";
                        } else if (s3 == 6 || s3 == 7) {
                            a3.innerHTML = "火";
                        } else if (s3 == 10 || s3 == 11) {
                            a3.innerHTML = "金";
                        }
                    }
                    sgrwx1(s3);


                    //下卦日五行 
                    function xgrwx1(rxg1) {
                        if (rxg1 == 1 || rxg1 == 2 || rxg1 == 12) {
                            d3.innerHTML = "水";
                        } else if (rxg1 == 3 || rxg1 == 8 || rxg1 == 9) {
                            d3.innerHTML = "土";
                        } else if (rxg1 == 4 || rxg1 == 5) {
                            d3.innerHTML = "木";
                        } else if (rxg1 == 6 || rxg1 == 7) {
                            d3.innerHTML = "火";
                        } else if (rxg1 == 10 || rxg1 == 11) {
                            d3.innerHTML = "金";
                        }
                    }
                    xgrwx1(rxg1);



                    //日 拆分的 第二个上下卦
                    s4.innerHTML = 10;
                    x4.innerHTML = 4;
                    a4.innerHTML = "金";
                    d4.innerHTML = "木";




                    //日 拆分的 第三个上下卦

                    //日的上卦
                    s5.innerHTML = parseInt(date % 10);
                    s5 = parseInt(date % 10)

                    //日的下卦
                    function getrxg(s5) {
                        if (s5 <= 6) {
                            x5.innerHTML = s5 + 6;
                            x5 = s5 + 6;
                            return x5;
                        } else {
                            x5.innerHTML = s5 - 6;
                            x5 = s5 - 6;
                            return x5;
                        }

                    }
                    var rxg = getrxg(s5);

                    //上卦+下卦日五行
                    function sgrwx(s5) {

                        //上卦日五行

                        if (s5 == 1 || s5 == 2 || s5 == 12) {
                            a5.innerHTML = "水";
                        } else if (s5 == 3 || s5 == 8 || s5 == 9) {
                            a5.innerHTML = "土";
                        } else if (s5 == 4 || s5 == 5) {
                            a5.innerHTML = "木";
                        } else if (s5 == 6 || s5 == 7) {
                            a5.innerHTML = "火";
                        } else if (s5 == 10 || s5 == 11) {
                            a5.innerHTML = "金";
                        }
                    }
                    sgrwx(s5);


                    //下卦日五行 
                    function xgrwx(rxg) {
                        if (rxg == 1 || rxg == 2 || rxg == 12) {
                            d5.innerHTML = "水";
                        } else if (rxg == 3 || rxg == 8 || rxg == 9) {
                            d5.innerHTML = "土";
                        } else if (rxg == 4 || rxg == 5) {
                            d5.innerHTML = "木";
                        } else if (rxg == 6 || rxg == 7) {
                            d5.innerHTML = "火";
                        } else if (rxg == 10 || rxg == 11) {
                            d5.innerHTML = "金";
                        }
                    }
                    xgrwx(rxg);





                    if (time == 0) {
                        //时的上卦
                        var s6 = document.getElementById("s6");
                        s6.innerHTML = "?";
                        //时的下卦
                        var x6 = document.getElementById("x6");
                        x6.innerHTML = "?";
                        //上卦+下卦时五行
                        var a6 = document.getElementById("a6");
                        var d6 = document.getElementById("d6");
                        a6.innerHTML = "?";
                        d6.innerHTML = "?";
                    } else {
                        //时的上下卦+五行

                        //时的上卦
                        var s6 = document.getElementById("s6");
                        s6.innerHTML = time;
                        s6 = time;
                        //时的下卦
                        var x6 = document.getElementById("x6");

                        function getsxg(time) {
                            if (time <= 6) {
                                x6.innerHTML = time + 6;
                                x6 = time + 6;
                                return x6;
                            } else {
                                x6.innerHTML = time - 6;
                                x6 = time - 6;
                                return x6;
                            }

                        }
                        var sxg = getsxg(time);

                        //上卦+下卦时五行
                        var a6 = document.getElementById("a6");
                        var d6 = document.getElementById("d6");

                        function sgswx(time) {

                            //上卦时五行

                            if (time == 1 || time == 2 || time == 12) {
                                a6.innerHTML = "水";
                            } else if (time == 3 || time == 8 || time == 9) {
                                a6.innerHTML = "土";
                            } else if (time == 4 || time == 5) {
                                a6.innerHTML = "木";
                            } else if (time == 6 || time == 7) {
                                a6.innerHTML = "火";
                            } else if (time == 10 || time == 11) {
                                a6.innerHTML = "金";
                            }
                        }
                        sgswx(time);


                        //下卦时五行 
                        function xgswx(sxg) {
                            if (sxg == 1 || sxg == 2 || sxg == 12) {
                                d6.innerHTML = "水";
                            } else if (sxg == 3 || sxg == 8 || sxg == 9) {
                                d6.innerHTML = "土";
                            } else if (sxg == 4 || sxg == 5) {
                                d6.innerHTML = "木";
                            } else if (sxg == 6 || sxg == 7) {
                                d6.innerHTML = "火";
                            } else if (sxg == 10 || sxg == 11) {
                                d6.innerHTML = "金";
                            }
                        }
                        xgswx(sxg);
                    }

                }
            }
            r(date);
        }


    }
</script>

</html>